package com.demo.date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @author gy
 * @date 2022/3/21
 */
public class LocalDateTimeTest {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
        String date = dateTimeFormatter.format(now);
        System.out.println("今天的日期："+date);

        LocalDate localDate = LocalDate.now();
        System.out.println("localDate:"+localDate);
        boolean leapYear = localDate.isLeapYear();
        System.out.println("========"+leapYear);

        LocalTime now1 = LocalTime.now();
        System.out.println("LocalTime："+ now1);
    }
}
